import types from '../types'

//状态管理
const state = {
	traceType: 1,	//商品类型
	cateId: '',	//商品分类id
	chargesSupperPrice: '',	//计算佣金的供货价
	chargesSalePrice: '',	//计算佣金的售价
	maket: [],				//活动会场列表
	decorate: []			//装修页面列表
}

//状态过滤
var getters ={

}

//调用时机
const actions = {
	traceTypeChange({ commit }, status) {	//商品类型改变
		
		commit(types.GOOD_TRACE_TYPE, status)
	},
	cateChange({ commit }, status) {	//商品分类改变
		
		commit(types.GOOD_CATE_STATUS, status)
	},
	setChargesPrice({ commit }, status) {	//佣金供货价，售价设置
		
		commit(types.GOOD_CHARGES_PRICE, status)
	},
	setMaket({ commit }, status) {	//活动会场列表
		commit(types.GOOD_MAKET_LIST, status)
	},
	setDecorate({ commit }, status) {
		commit(types.GOOD_DECORATE_LIST, status)
	}
}


//处理逻辑
const mutations = {
	[types.GOOD_TRACE_TYPE](state, status) {
		state.traceType = status
	},
	[types.GOOD_CATE_STATUS](state, status) {
		state.cateId = status
	},
	[types.GOOD_CHARGES_PRICE](state, status) {
		state.chargesSupperPrice = status.supperPrice
		state.chargesSalePrice = status.salePrice
	},
	[types.GOOD_MAKET_LIST](state, status) {
		state.maket = status
	},
	[types.GOOD_DECORATE_LIST](state, status) {
		state.decorate = status
	}
}


export default {
	state,
	getters,
	actions,
	mutations
}
